package com.mr.base.alpha.controllers;

import com.mr.base.core.alibaba.annotations.RestfulResult;
import com.mr.base.core.common.vo.OptionsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/common")
@Slf4j
@Api(value = "通用接口" , tags= {"通用接口","V1.2.0"} )
@RestfulResult
public class CommonController {

    @ApiOperation(notes = "返回所有的爬虫任务站点" , value = "爬虫任务站点" , nickname = "commonSites")
    @ApiResponses({
            @ApiResponse(responseCode = "200", description = "Success" , content =
            @Content(array = @ArraySchema(schema = @Schema(implementation = String.class))
                    , mediaType = MediaType.APPLICATION_JSON_VALUE) ),
    })
    @GetMapping(value = "/site" , produces = MediaType.APPLICATION_JSON_VALUE )
    public List<OptionsVO> sites(){
        return Arrays.asList(
                OptionsVO.builder().value("US").build(),
                OptionsVO.builder().value("JP").build(),
                OptionsVO.builder().value("IN").build()
        );
    }

}
